<template>
  <div class="person-watchEffect`">
    <h2>
      需求：监控温度变化
      内温：{{ num }}
      座驾：{{ num1 }}
      <button @click="onChange">调节水温</button>
    </h2>
   
  </div>
</template>

<script lang="ts" setup name="Person-watchEffect">
import {reactive,ref,watch, watchEffect} from 'vue'

let num = ref(10)
let num1= ref(20)

function onChange() {
  num.value+=10;
  num1.value+=10;
}

const stopWatch = watchEffect(()=>{
  if(num.value>=50 || num1.value>=40){
    console.log("联系客服。。。",num.value,num1.value)
  }
  if(num.value==50|| num1.value==50){
    console.log("清理空间")
    stopWatch()
  }
})

</script>